from PIL import Image, ImageDraw

img = Image.new('RGBA', (400, 400), 'white')

#在img上生成一个画笔
pen = ImageDraw.Draw(img)

#画点
pen.point([(190, 200), (200, 200), (210, 200)], 'blue')

#画线
pen.line([(180,180), (220, 180), (220, 220), (180, 220), (180,180) ], 'red')

#画一个矩形
pen.rectangle((300,300, 320, 320), 'blue')

#写字
pen.text((350, 350), 'Python', 'blue')

img.save('draw/' + 'myImg.png')